(function(){ 
    var _lotteryCodes = ["0","0","0","0"];
    var _lotteryCode0Tem = cc.sys.localStorage.getItem('LotteryCode0');
    var _lotteryCode1Tem = cc.sys.localStorage.getItem('LotteryCode1');
    var _lotteryCode2Tem = cc.sys.localStorage.getItem('LotteryCode2');
    var _lotteryCode3Tem = cc.sys.localStorage.getItem('LotteryCode3');

    if(typeof _lotteryCode0Tem == "string"){
        _setLotteryCode(0,_lotteryCode0Tem);
    }else{
        _setLotteryCode(0,0);
    }
    if(typeof _lotteryCode1Tem == "string"){
        _setLotteryCode(1,_lotteryCode1Tem);
    }else{
        _setLotteryCode(1,0);
    }
    if(typeof _lotteryCode2Tem == "string"){
        _setLotteryCode(2,_lotteryCode2Tem);
    }else{
        _setLotteryCode(2,0);
    }
    if(typeof _lotteryCode3Tem == "string"){
        _setLotteryCode(3,_lotteryCode3Tem);
    }else{
        _setLotteryCode(3,0);
    }

    function _setLotteryCode(index,value){
        if(index>=0&&index<4)
        {
            _lotteryCodes[index] = value;
            var name = "LotteryCode"+index;
            cc.sys.localStorage.setItem(name,value);
        }
    }

    function _getLotteryCode(index){
        return _lotteryCodes[index];
    }


    var _Room={
        setLotteryCode:_setLotteryCode,
        getLotteryCode:_getLotteryCode,
    }
   
   window.Room=_Room; 
    
} 
)();


